# CtfScoreboardApi.ChallengeApi

All URIs are relative to *https://localhost/v1*

Method | HTTP request | Description
------------- | ------------- | -------------
[**addChallenge**](ChallengeApi.md#addChallenge) | **POST** /challenge | add a challenge
[**deleteChallenge**](ChallengeApi.md#deleteChallenge) | **DELETE** /challenge/{id} | Delete challenge
[**getAllChallenges**](ChallengeApi.md#getAllChallenges) | **GET** /challenge/all | Get all challenge
[**getChallengeById**](ChallengeApi.md#getChallengeById) | **GET** /challenge/{id} | Get challenge
[**submitFlag**](ChallengeApi.md#submitFlag) | **POST** /challenge/submitflag | Submit a flag
[**updateChallenge**](ChallengeApi.md#updateChallenge) | **PUT** /challenge/{id} | Updated challenge


<a name="addChallenge"></a>
# **addChallenge**
> Challenge addChallenge(body)

add a challenge

will add a challenge. 

### Example
```javascript
var CtfScoreboardApi = require('ctf_scoreboard_api');

var apiInstance = new CtfScoreboardApi.ChallengeApi();

var body = new CtfScoreboardApi.Challenge(); // Challenge | Challenge object to be added to the scoreboard


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.addChallenge(body, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **body** | [**Challenge**](Challenge.md)| Challenge object to be added to the scoreboard | 

### Return type

[**Challenge**](Challenge.md)

### Authorization

No authorization required

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json

<a name="deleteChallenge"></a>
# **deleteChallenge**
> deleteChallenge(id)

Delete challenge

This can only be done by the logged in user.

### Example
```javascript
var CtfScoreboardApi = require('ctf_scoreboard_api');

var apiInstance = new CtfScoreboardApi.ChallengeApi();

var id = "id_example"; // String | The id of the challenge that needs to be deleted


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.deleteChallenge(id, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **id** | **String**| The id of the challenge that needs to be deleted | 

### Return type

null (empty response body)

### Authorization

No authorization required

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

<a name="getAllChallenges"></a>
# **getAllChallenges**
> ChallengeList getAllChallenges()

Get all challenge



### Example
```javascript
var CtfScoreboardApi = require('ctf_scoreboard_api');

var apiInstance = new CtfScoreboardApi.ChallengeApi();

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getAllChallenges(callback);
```

### Parameters
This endpoint does not need any parameter.

### Return type

[**ChallengeList**](ChallengeList.md)

### Authorization

No authorization required

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

<a name="getChallengeById"></a>
# **getChallengeById**
> Challenge getChallengeById(id)

Get challenge



### Example
```javascript
var CtfScoreboardApi = require('ctf_scoreboard_api');

var apiInstance = new CtfScoreboardApi.ChallengeApi();

var id = "id_example"; // String | The id that needs to be fetched.


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getChallengeById(id, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **id** | **String**| The id that needs to be fetched. | 

### Return type

[**Challenge**](Challenge.md)

### Authorization

No authorization required

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

<a name="submitFlag"></a>
# **submitFlag**
> Challenge submitFlag(body)

Submit a flag



### Example
```javascript
var CtfScoreboardApi = require('ctf_scoreboard_api');

var apiInstance = new CtfScoreboardApi.ChallengeApi();

var body = new CtfScoreboardApi.Challenge(); // Challenge | Challenge object with flag (only id and flag is needed, no update of the data)


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.submitFlag(body, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **body** | [**Challenge**](Challenge.md)| Challenge object with flag (only id and flag is needed, no update of the data) | 

### Return type

[**Challenge**](Challenge.md)

### Authorization

No authorization required

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json

<a name="updateChallenge"></a>
# **updateChallenge**
> updateChallenge(id, body)

Updated challenge

This can only be done by the logged in user.

### Example
```javascript
var CtfScoreboardApi = require('ctf_scoreboard_api');

var apiInstance = new CtfScoreboardApi.ChallengeApi();

var id = "id_example"; // String | id of challenge that need to be updated

var body = new CtfScoreboardApi.Challenge(); // Challenge | Updated challenge object


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.updateChallenge(id, body, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **id** | **String**| id of challenge that need to be updated | 
 **body** | [**Challenge**](Challenge.md)| Updated challenge object | 

### Return type

null (empty response body)

### Authorization

No authorization required

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

